package cn.wolfcode.mp;


import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
@MapperScan("cn.wolfcode.mp.mapper")
public class App {
    //分页插件
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(DbType.MYSQL);//1指定操作的数据类型类型
        paginationInnerInterceptor.setOverflow(true); //2合理化(比如，输入-1页，处理为1页)
        interceptor.addInnerInterceptor(paginationInnerInterceptor);
        return interceptor;
    }
    public static void main(String[] args) {
        SpringApplication.run(App.class, args);
    }
}
